#include <cstdio>
#include <cstring>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int, int> pii;

#define MAXN 28

int P, Q;
bool MAP[MAXN][MAXN];
vector<pii> history;
int dir[8][2] = {
//    {-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1},
    {-1, -2}, {1, -2}, {-2, -1}, {2, -1}, {-2, 1}, {2, 1}, {-1, 2}, {1, 2}
};

bool DFS(int p, int q, int d) {
    if (d == P*Q) {
        history.push_back(make_pair(p, q));
        return true;
    }
    MAP[p][q] = true;
    for (int i=0; i<8; i++) {
        int np = p+dir[i][0];
        int nq = q+dir[i][1];
        if (np >= 1 && np <= P && nq >= 1 && nq <= Q && !MAP[np][nq]) {
            if (DFS(np, nq, d+1)) {
                history.push_back(make_pair(p, q));
                return true;
            }
        }
    }
    MAP[p][q] = false;
    return false;
}



int main() {
    int T;
    scanf("%d", &T);
    for (int kase=1; kase<=T; kase++) {
        scanf("%d%d", &P, &Q);
        history.clear();
        printf("Scenario #%d:\n", kase);
        bool flag = false;
        for (int i=1; i<=Q; i++) {
            for (int j=1; j<=P; j++) {
                memset(MAP, 0, sizeof(MAP));
                if (DFS(j, i, 1)) {
                    for (int i=history.size()-1; i>=0; i--) {
                        int p = history[i].first;
                        int q = history[i].second;
                        printf("%c%c", q-1+'A', p+'0');
                    }
                    printf("\n\n");
                    flag = true;
                    goto fin;
                }
            }
        }
        if (!flag) {
            printf("impossible\n\n");
        }
        fin:
        ;
    }
    return 0;
}
